package com.zhuang.chapter18;

public class RectangleMain {

	public static void main(String[] args) {
		Rectangle rectangle1 = new Rectangle(10, 20);
		Rectangle rectangle2 = new Rectangle(20, 30);
		rectangle1.countArea();
		rectangle1.countCircumference();
		System.out.println("----------------------------------");
		rectangle2.countArea();
		rectangle2.countCircumference();

	}

}

class Rectangle {
	private int length;
	private int width;
	private int circu;
	private int area;

	public Rectangle(int length, int width) {
		super();
		this.length = length;
		this.width = width;
	}

	public int getLength() {
		return length;
	}

	public void setLength(int length) {
		this.length = length;
	}

	public int getWidth() {
		return width;
	}

	public void setWidth(int width) {
		this.width = width;
	}

	public int getCircu() {
		return circu;
	}

	public void setCircu(int circu) {
		this.circu = circu;
	}

	public int getArea() {
		return area;
	}

	public void setArea(int area) {
		this.area = area;
	}

	public void countCircumference() {
		circu = (length + width) * 2;
		System.out.println("矩形周长为-->" + circu);
	}

	public void countArea() {
		area = length * width;
		System.out.println("矩形面积为-->" + area);
	}
}
